#include "cpu/exec/helper.h"

#define DATA_BYTE 2
#include "call-template.h"
#undef DATA_BYTE

#define DATA_BYTE 4
#include "call-template.h"
#undef DATA_BYTE

make_helper_v(call_i)

    make_helper(call_rm_2)
{
    if (ops_decoded.is_operand_size_16)
    {
        panic("call 16 in call_rm_2\n");
    }
    else
    {
        int len = decode_rm_l(eip + 1);
        reg_l(R_ESP) -= 4;
        current_sreg = R_SS;
        swaddr_write(reg_l(R_ESP), 4, cpu.eip + len + 1);
        cpu.eip = op_src->val;
        print_asm(str(call) str(l) " %s", op_src->str);
        cpu.eip -= len + 1;
        return len + 1;
    }
}
